using System;
using System.Data;
using System.Configuration;
using System.Web;		    
using System.Drawing;   

namespace Possan.Graphics.Filters
{
	public class FillBackground : IBaseFilter
	{
		public string ParameterDefinition
		{
			get
			{
				     return null;
			}
		}

		public string Color;

		public FillBackground()
		{
			Color = "";
		}

		public Bitmap Filter(Bitmap bitmap)
		{
			Bitmap bmp2 = new Bitmap(bitmap.Width, bitmap.Height);
			bmp2.SetResolution(bitmap.HorizontalResolution, bitmap.VerticalResolution);

			System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp2);
			if (Color != "")
			{
				Color c = Utilities.ParseHtmlColor(Color);
				if( c.A > 0 )
					g.FillRectangle(new SolidBrush(c), new Rectangle(0, 0, bitmap.Width, bitmap.Height));
			}
			g.DrawImage(bitmap, 0, 0);

			     return bmp2;
		}

		public void Dispose()
		{
		}
	}
}





